<?php namespace Home\Controller; 

use Hdphp\Controller\Controller;

//前台总控制器
class IndexController extends Controller{
	
	//构造函数
	public function __init(){
		
	}
	
//前台首页页面
    public function index(){
//p($_SESSION);
//**********************实例化分类表****************************
	$cateModel = new \Common\Model\cate;
	
	$topModel  = $cateModel->orderBy('cid','ASC')->limit(5)->get();
//	p($topModel);
	View::with('topModel',$topModel);
	
	

//		获得分类表里面的所有数据
	$cateModel = $cateModel->orderBy('cid','ASC')->get();
//		把数据分成有参次
	$oldModel = Data::channelLevel($cateModel, $pid = 0, $html = "&nbsp;", $fieldPri = 'cid', $fieldPid = 'pid', $level = 1);
	
//	p($oldModel);
	foreach ($oldModel as $v) {
		foreach ($v['_data'] as $kk => $vv) {
//		p($vv);
			foreach ($vv as $kkk => $vvv) {
//				p($vvv);
						
			}
		}
	}
//		分配变量
	View::with('cateModel',$oldModel);


       View::make();
    }
	
	
	
	public function dell(){
		session_unset();
		session_destroy();
		View::success('退出成功',U('Index/index'));
	}







	
	
}
